package com.sl.au.service.impl;

import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.EXDEPeopleHostReceiveStatistics;
import com.sl.au.repository.EXDEPaidMainframeStaffRepository;
import com.sl.au.service.EXDEPaidMainframeStaffService;

/**
 * 人员-主机到款统计视图层
 * @author yry
 * 2017-02-20
 */
@Service("EXDEPaidMainframeStaffService")
@Transactional
public class EXDEPaidMainframeStaffServiceImpl extends BaseServiceImpl implements EXDEPaidMainframeStaffService {

	@Autowired
	EXDEPaidMainframeStaffRepository exdePaidMainframeStaffRepository;

	@PersistenceContext
	private EntityManager em;
	
	@Override
	public EXDEPaidMainframeStaffRepository getRepository() {
		return this.exdePaidMainframeStaffRepository;
	}

	/**
	 * 查询
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<EXDEPeopleHostReceiveStatistics> getMyPage(int start, int length, Map<String, String> condition) {
		List<EXDEPeopleHostReceiveStatistics> pages=null;
		//System.out.println(condition.get("beginPaidDate")+","+condition.get("endPaidDate")+","+condition.get("type"));
		Query query = this.em.createNativeQuery("{call getPeopleHostReceiveStatistics(?,?,?,?)}",EXDEPeopleHostReceiveStatistics.class);
		query.setParameter(1, condition.get("beginPaidDate"));
		query.setParameter(2, condition.get("endPaidDate"));
		query.setParameter(3, condition.get("type"));
		query.setParameter(4, condition.get("sSuperior"));
		pages = query.getResultList();
		return pages;
	}

}
